/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package towerz.component.panel;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 *
 * @author LegACy
 */
public class Panel {
	//Constants
	protected static final long ANIMATION_DELAY = 100;

	protected Panel() {
		//Initialize
		m_X				= 0;
		m_Y				= 0;
		m_Gold			= 0;
		m_Time			= 0;
		m_Visible		= false;
		m_Background	= null;
	}

	protected Panel(Image image, int x, int y) {
		//Default
		this();

		//Save
		m_X				= x;
		m_Y				= y;
		m_Background	= image;
	}

	public boolean isVisible() {
		return m_Visible;
	}

	public void show() {
		//Show panel
		m_Visible = true;
	}

	public void hide() {
		//Hide panel
		m_Visible = false;
	}

	public void update(int keys, int gold, long time) {
		//Save
		m_Gold = gold;

		//Decrease time
		m_Time -= time;
	}

	public void draw(Graphics g) {
		//Skip if not visible
		if (!m_Visible) return;

		//Draw panel
		g.drawImage(m_Background, m_X, m_Y, Graphics.LEFT | Graphics.TOP);
	}

	//Members
	protected int		m_X;
	protected int		m_Y;
	protected int		m_Gold;
	protected long		m_Time;
	protected boolean	m_Visible;
	protected Image		m_Background;
}
